#!/bin/sh

#############################################################################
# pturlreplace.sh
# This file is part of PTurlmigration.
#
# PTurlmigration -  http://code.google.com/p/alui-toolbox/
# Copyright (c) 2008-2009
# by Fabien Sanglier
#
# PTurlmigration is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# PTurlmigration is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with PTurlmigration.  If not, see <http://www.gnu.org/licenses/>.
#
############################################################################
if [ $1. = . ]; then
    # Make sure the environment is set
    portal_bin=`dirname $0`
    eval `sh $portal_bin/portalenv.sh`

    echo "Running ptmigration..."
    echo "Please enter the application name:"
    read appname

    echo "Please enter Administrator Username:"
    read username

    echo -n "Password: "

    stty -echo
    read password
    stty echo

    echo ""         # force a carriage return to be output

    echo "Please enter the pattern to look for (regular expression):"
    read pattern

    echo "Please enter the text to replace with:"
    read replacement

    echo "Do you want to run in debug mode? [true/false]"
    read isdebug

    "java" -jar PTURLMigration.jar "$appname" "$username" "$password" "$pattern" "$replacement" "$isdebug"

else
    echo Migrate Database information from Environment 1 to Environment 2
    echo
    echo Usage: pturlreplace.sh
    echo
fi